﻿App.EditMaterielInfo= function(grid) {
	var win = new App.AddMaterielInfo(grid,true);
	var formPanel = win.findByType('form')[0];
	var saveBtn = win.buttons[0];
	var record = grid.getSelectionModel().getSelected();
	win.setTitle('编缉物料信息');
	
	saveBtn.setHandler(function(){
		if (formPanel.form.isValid()) {
			formPanel.form.submit({
				waitTitle : "请稍候",
				waitMsg : '正在保存数据...',
				params : {
					trancode : '12133'
				},
				method : 'Post',
				failure : function(form, action) {
					Ext.MessageBox.alert('操作失败', action.result.message);
				},
				success : function(form, action) {
					if (action.result.success) {
						Ext.MessageBox.alert('操作成功',
								action.result.message);
						win.close();
						grid.getStore().reload();
					} else {
						Ext.MessageBox.alert('操作失败',
								action.result.message);
					}
				}
			});
		} else {
			Ext.MessageBox.alert('输入错误', '请输完内容后再保存！');
		}
	});
	
	win.show();
	formPanel.getForm().loadRecord(record);
}